<?php

/**
 * 内核启动
 */

namespace variant\core;

class Kernel {

	/**
	 * 运行框架
	 */
	static public function run() {
    
		$controller = '\app\\'. APP_NAME .'\controller\\'. CONTROLLER_NAME .'Controller';
		$action = ACTION_NAME;

		if( !class_exists($controller) ) {
			throw new \Exception("Controller '{$controller}' not found", 500);
		}
		$obj = new $controller();
		if(!method_exists($obj, $action) ){
			throw new \Exception("Action '{$controller}::{$action}()' not found", 500);
		}
		$obj->$action();
	}
}